﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CanvaController : MonoBehaviour {

	private RectTransform gameRunTime;
	private RectTransform resultPanel;
	void Start () {
		gameRunTime = transform.GetChild (0).GetComponent<RectTransform> ();
		resultPanel = transform.GetChild (1).GetComponent<RectTransform> ();
	}

	public void ShowGameOver(){
		resultPanel.gameObject.SetActive (true);
		gameRunTime.gameObject.SetActive (false);
		GetComponent<GameResult>().GameOver ();
	}

	void Update(){
		if (Input.GetKeyDown (KeyCode.Space)) {
			if (resultPanel.gameObject.activeSelf) {
				GetComponent<GameResult>().ReTry ();
			}
		}
	}
}
